extends "res://tanks/Tank.gd"

func control(delta):
	$Turret.look_at(get_global_mouse_position())
	var rot_dir = 0
	if Input.is_action_pressed("move_left"):
		rot_dir -= 1
	if Input.is_action_pressed("move_right"):
		rot_dir += 1
	#计算旋转角度
	rotation += rotation_speed * rot_dir * delta
	
	velocity = Vector2()
	if Input.is_action_pressed("move_up"):
		velocity = Vector2(speed, 0).rotated(rotation)
	if Input.is_action_pressed("move_down"):
		velocity = Vector2(-speed/2, 0).rotated(rotation)
